a;l;main(n,v){for(gets(&n);~scanf("%d",&n);printf("%d\n",2*(l-a)))for(a=99,l=0;n--;scanf("%d",&v),a=a<v?a:v,l=l>v?l:v);}
